package com.liang.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.liang.mall.entity.Log;
import com.liang.mall.util.ResultEntity;
import com.liang.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 系统日志 前端控制器
 * </p>
 *
 * @author liang
 * @since 2021-05-10
 */
@RestController
@RequestMapping("/log")
public class LogController {

    @Autowired
    LogService logService;

    @GetMapping("/list")

//    @PreAuthorize("hasAnyRole('superadmin')")
    @PreAuthorize("hasAuthority('sys:log:list')")
    public ResultEntity<IPage> getLogList(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize){

        IPage<Log> logIPage =   logService.getList(pageNum,pageSize);


        return  ResultEntity.ok(logIPage);

    }

}

